package com.plm.k8s.myk8sapi.cmd;

import com.plm.k8s.myk8sapi.pojo.entity.service.ServiceEntity;
import com.plm.k8s.myk8sapi.pojo.entity.service.ServiceSpecPortEntity;

import java.io.File;
import java.util.List;
import java.util.Map;

/**
 * service相关的命令
 * @author 潘磊明
 * 版本号：1.0
 * 创建日期：2021/7/26 14:06
 */
public interface IServiceCmd {

    /**
     * 获取service
     * @param isAll
     * @param namespace
     * @param nameFilter
     * @param labelFilter
     * @return
     * @throws Exception
     */
    List<ServiceEntity> listService(boolean isAll, String namespace, String nameFilter, Map<String, String> labelFilter) throws Exception;

    /**
     * 使用yaml文件创建service
     * @param yamlFile
     * @return
     */
    boolean createService(File yamlFile) throws Exception;

    /**
     * 创建服务
     * @param name
     * @param namespace
     * @param selector
     * @param type
     * @param ports
     * @return
     */
    boolean createService(String name, String namespace, Map<String, String> selector, String type
            , List<ServiceSpecPortEntity> ports) throws Exception;

    /**
     * 创建服务
     * @param name
     * @param namespace
     * @param selector
     * @param type
     * @param ports
     * @param labels
     * @return
     */
    boolean createService(String name, String namespace, Map<String, String> selector, String type
            , List<ServiceSpecPortEntity> ports, Map<String, String> labels) throws Exception;

    /**
     * 删除服务
     * @param name
     * @param namespace
     * @param isForce
     * @return
     * @throws Exception
     */
    boolean deleteService(String name, String namespace, boolean isForce) throws Exception;
}
